//给出两个非递减数组a和b，以及m,n分别代表两个数组的元素个数，合并两个数组，并且合并之后的数组同样按照非递减顺序排列

#include<iostream>
#include<vector>
using namespace std;

int m = 3, n = 3;
int a[] = {1, 2, 3, 0, 0, 0};
int b[] = {2, 5, 6};

int main()
{
    vector<int> tmp(m + n);
    int cur = 0,  cur1 = 0, cur2 = 0;
    while(cur1 < m && cur2 < n)
    {
        if(a[cur1] <= b[cur2]) tmp[cur ++] = a[cur1 ++];
        else tmp[cur ++] = b[cur2 ++];
    }
    while(cur1 < m) tmp[cur ++] = a[cur1 ++];
    while(cur2 < n) tmp[cur ++] = b[cur2 ++];

    for(int i = 0; i < m + n; i ++)
        cout << tmp[i] << " ";
    return 0;
}